#ifndef _SB3D_ENGINE_H_
#define _SB3D_ENGINE_H_

// PERFORMANCE INFO
#define MIN_FPS         	0.1		// host minimum fps value for maxfps.
#define MAX_FPS         	1000.0		// upper limit for maxfps.

#define MAX_FRAMETIME	0.1
#define MIN_FRAMETIME	0.001

typedef enum
{
	HOST_INIT = 0,	// initalize operations
	HOST_FRAME,	// host running
	HOST_SHUTDOWN,	// shutdown operations	
	HOST_ERROR,	// host stopped by error
	HOST_ERR_FATAL,	// sys error
	HOST_SLEEP,	// sleeped by different reason, e.g. minimize window
	HOST_NOFOCUS,	// same as HOST_FRAME, but disable mouse
	HOST_RESTART,	// during the changes video mode
	HOST_CRASHED	// an exception handler called
} host_state;

typedef struct host_parm_s
{
	host_state			state;			// global host state
	
	double				realtime;		// host.curtime
	double				frametime;		// time between engine frames
	double				realframetime;	// for some system events, e.g. console animations

	unsigned int		framecount;		// global framecount




} host_parm_t;

class sb3dEngine
{
public:
	bool Init( void );
	bool Shutdown( void );
	bool Frame( float time );

	bool Run( void );
	
	bool FilterTime( float time );
private:
	bool bQuit;
	
	double	oldtime, newtime;
	double  filteroldtime;
};

#endif